﻿namespace Borg.AddOn
{
    internal sealed class CompositionEngineNotificationHookChain : ICompositionEngineNotificationHook
    {
        private readonly ICompositionEngineNotificationHook[] _hooks;

        public CompositionEngineNotificationHookChain(ICompositionEngineNotificationHook[] hooks)
        {
            _hooks = hooks;
        }

        public void OnAutoPluggingAborted(Slot slot, Plug plug)
        {
            foreach (ICompositionEngineNotificationHook hook in _hooks)
                hook.OnAutoPluggingAborted(slot, plug);
        }

        public void OnAutoPluggingStarted(Slot slot, Plug plug)
        {
            foreach (ICompositionEngineNotificationHook hook in _hooks)
                hook.OnAutoPluggingStarted(slot, plug);
        }

        public void OnAutoTaggingAborted(Slot slot, Plug plug, string name)
        {
            foreach (ICompositionEngineNotificationHook hook in _hooks)
                hook.OnAutoTaggingAborted(slot, plug, name);
        }

        public void OnAutoTaggingStarted(Slot slot, Plug plug, string name)
        {
            foreach (ICompositionEngineNotificationHook hook in _hooks)
                hook.OnAutoTaggingStarted(slot, plug, name);
        }

        public void OnTryAutoPlugging(Slot slot, Plug plug)
        {
            foreach (ICompositionEngineNotificationHook hook in _hooks)
                hook.OnTryAutoPlugging(slot, plug);
        }

        public void OnTryAutoTagging(Slot slot, Plug plug, string name)
        {
            foreach (ICompositionEngineNotificationHook hook in _hooks)
                hook.OnTryAutoTagging(slot, plug, name);
        }
    }
}
